﻿namespace ExamV5.WAPPage
{
    using ExamV5;
    using System;
    using System.Configuration;
    using System.Data;
    using System.Data.SqlClient;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;

    public class FrmShowZExam : Page
    {
        protected HtmlForm form1;
        protected HtmlHead Head1;
        private HttpCookie httpCookie_0 = null;
        private HttpCookie httpCookie_1 = null;
        private HttpCookie httpCookie_2 = null;
        private HttpCookie httpCookie_3 = null;
        protected ImageButton ImgButExit;
        protected ImageButton ImgEnter;
        protected ImageButton ImgLook;
        protected ImageButton ImgReRnd;
        private int int_0 = 0;
        protected Label labDiff;
        protected Label labExamName;
        protected Label labFen;
        protected Label labGetFen;
        protected Label labRubricDist;
        protected Label labSETime;
        protected Label labSubjectName;
        private PublicFun publicFun_0 = new PublicFun();
        private string string_0 = "";
        private string string_1 = "";

        protected void ImgButExit_Click(object sender, ImageClickEventArgs e)
        {
            base.Response.Cookies["ExamUserCode"].Value = "";
            base.Response.Cookies["ExamUserName"].Value = "";
            base.Response.Cookies["ExamDeptName"].Value = "";
            base.Response.Cookies["ExamDeptID"].Value = "";
            base.Response.Cookies["ExamWorker"].Value = "";
            base.Response.Cookies["ExamUserSex"].Value = "";
            base.Response.Cookies["ExamUserLevel"].Value = "";
            base.Response.Cookies["ExamUserGWName"].Value = "";
            base.Response.Cookies["ExamUserGWLevel"].Value = "";
            base.Response.Redirect("FrmLogin.aspx");
        }

        protected void ImgEnter_Click(object sender, ImageClickEventArgs e)
        {
            if (!(this.ImgEnter.ImageUrl == "image/butEnterExam.jpg"))
            {
                this.SysEnterPaper();
            }
            else
            {
                base.Response.Write("<script>window.location.href='FrmJoinExam.aspx?ID=" + this.int_0 + "'</script>");
                base.Response.End();
            }
        }

        protected void ImgLook_Click(object sender, ImageClickEventArgs e)
        {
            if (!(this.ViewState["UserPower"].ToString() == "Y"))
            {
                base.Response.Write("<script>alert('查看考卷权限暂未开放');</script>");
            }
            else
            {
                string str;
                string values = this.publicFun_0.GetValues("select LookPaperID from UserPower where UserCode='" + this.httpCookie_0.Value + "'", "LookPaperID");
                if (values.Trim() != "")
                {
                    if (values.Trim().IndexOf("," + this.int_0.ToString() + ",") < 0)
                    {
                        base.Response.Write("<script>alert('查看考卷权限暂未开放');</script>");
                    }
                    else
                    {
                        str = base.Request.Url.ToString();
                        str = str.Substring(0, str.LastIndexOf('/') + 1);
                        base.Response.Redirect(str + "FrmLookStudy.aspx?ID=" + this.int_0);
                    }
                }
                else
                {
                    str = base.Request.Url.ToString();
                    str = str.Substring(0, str.LastIndexOf('/') + 1);
                    base.Response.Redirect(str + "FrmLookStudy.aspx?ID=" + this.int_0);
                }
            }
        }

        protected void ImgReRnd_Click(object sender, ImageClickEventArgs e)
        {
            string str = this.int_0.ToString();
            string connectionString = ConfigurationManager.ConnectionStrings["Conn"].ConnectionString;
            string str3 = "";
            string str4 = "";
            string str5 = "";
            string str6 = "";
            string str7 = "";
            SqlConnection connection = new SqlConnection(connectionString);
            connection.Open();
            SqlCommand command = new SqlCommand("select a.ExamName,a.PaperStatus,a.RubricDist,a.SubjectID,a.SubjectName,a.PaperDiff,a.ExamTime from PaperInfo a where  a.PaperStatus='A' and a.ID=" + str, connection);
            SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
            if (reader.Read())
            {
                str3 = reader["RubricDist"].ToString();
                str4 = reader["SubjectID"].ToString();
                reader["SubjectName"].ToString();
                str5 = reader["PaperDiff"].ToString();
                str6 = reader["PaperStatus"].ToString();
                reader["ExamName"].ToString();
                str7 = reader["ExamTime"].ToString();
            }
            reader.Close();
            command.Dispose();
            connection.Close();
            connection.Dispose();
            string[] strArray = str4.Split(new char[] { ',' });
            string str10 = "";
            for (int i = 0; i < strArray.Length; i++)
            {
                if (str10.Trim().Length != 0)
                {
                    str10 = str10 + " or SubjectID='" + strArray[i].Trim() + "'";
                }
                else
                {
                    str10 = "SubjectID='" + strArray[i].Trim() + "'";
                }
            }
            try
            {
                string str8 = "";
                if (!(this.publicFun_0.GetValues("select PaperID from PaperRule where PaperID=" + str, "PaperID") != ""))
                {
                    str8 = "A";
                }
                else
                {
                    str8 = "B";
                }
                if (str8.Trim() == "A")
                {
                    this.method_2(str, str3.Trim(), str10, str5, str6, str7);
                }
                if (str8.Trim() == "B")
                {
                    string str9 = "select ID from RubricInfo where IsDel='N' and Flag='" + str6 + "' and ISCheck='N'";
                    this.method_3(str, str9, str3, str7);
                }
                base.Response.Write("<script>alert('重新随机生成新试卷操作成功！');setTimeout(function(){window.location='FrmShowZExam.aspx?ID=" + this.int_0 + "'},500);</script>");
            }
            catch
            {
                base.Response.Write("<script>alert('重新随机生成新试卷操作失败！');</script>");
            }
        }

        private void method_0()
        {
            string cmdText = string.Concat(new object[] { "select b.StartIP,b.EndIP,b.StudyPlanID,b.JoinExamNum,a.JoinExamNum as ExamNum,b.RubricTypeName,b.NoWriteFen,b.ErrorFen,b.RubricDist,b.FenDist,b.PaperDiff,a.GetCountFen,a.Flag,b.ID,b.ExamName,b.SubjectName,b.PaperFen,b.ExamTime,b.PaperStartTime,b.PaperEndTime from ExamUser a ,PaperInfo b  where  b.PaperStatus='A' and  a.UserCode='", this.httpCookie_0.Value.Trim(), "'  and a.PaperID=b.ID and b.ISCheck='N' and b.ID=", this.int_0 });
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            connection.Open();
            SqlCommand command = new SqlCommand(cmdText, connection);
            SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
            if (reader.Read())
            {
                this.labExamName.Text = reader["ExamName"].ToString();
                this.labSubjectName.Text = reader["SubjectName"].ToString();
                this.labFen.Text = reader["PaperFen"].ToString();
                this.labSETime.Text = reader["PaperStartTime"].ToString().Substring(0, reader["PaperStartTime"].ToString().Length - 3) + "—" + reader["PaperEndTime"].ToString().Substring(0, reader["PaperEndTime"].ToString().Length - 3);
                switch (reader["PaperDiff"].ToString())
                {
                    case "A":
                        this.labDiff.Text = "难";
                        break;

                    case "B":
                        this.labDiff.Text = "较难";
                        break;

                    case "C":
                        this.labDiff.Text = "中等";
                        break;

                    case "D":
                        this.labDiff.Text = "较易";
                        break;

                    case "E":
                        this.labDiff.Text = "容易";
                        break;
                }
                string[] strArray2 = reader["RubricDist"].ToString().Split(new char[] { '#' });
                string[] strArray4 = reader["FenDist"].ToString().Split(new char[] { '#' });
                string[] strArray6 = reader["NoWriteFen"].ToString().Split(new char[] { '#' });
                string[] strArray5 = reader["ErrorFen"].ToString().Split(new char[] { '#' });
                string[] strArray3 = reader["RubricTypeName"].ToString().Split(new char[] { '#' });
                for (int i = 0; i < strArray2.Length; i++)
                {
                    if (i >= 9)
                    {
                        if (strArray2[9].ToString().Length > 1)
                        {
                            this.labRubricDist.Text = this.labRubricDist.Text + "<br>" + strArray3[i] + ":<font color='red'>" + Convert.ToString(strArray2[9].ToString().Split(new char[] { '_' }).Length) + "</font>道，每道<font color='red'>" + strArray4[9].ToString().Replace("_", " /") + "</font>分/空";
                        }
                    }
                    else
                    {
                        if (strArray2[i].ToString() != "0")
                        {
                            this.labRubricDist.Text = this.labRubricDist.Text + "<br>" + strArray3[i] + ":<font color='red'>" + strArray2[i] + "</font>道，每道<font color='red'>" + strArray4[i] + "</font>分";
                        }
                        if (i < 3)
                        {
                            if (strArray6[i].ToString() != "0")
                            {
                                this.labRubricDist.Text = this.labRubricDist.Text + "，未答倒扣<font color='red'>" + strArray6[i] + "</font>分/道";
                            }
                            if (strArray5[i].ToString() != "0")
                            {
                                this.labRubricDist.Text = this.labRubricDist.Text + "，答错倒扣<font color='red'>" + strArray5[i] + "</font>分/道";
                            }
                        }
                    }
                }
                if (this.labRubricDist.Text.Length > 4)
                {
                    this.labRubricDist.Text = this.labRubricDist.Text.Substring(4);
                }
                switch (reader["Flag"].ToString())
                {
                    case "A":
                        this.labGetFen.Text = "暂未作答";
                        this.ImgLook.ImageUrl = "image/butLookMXDis.jpg";
                        this.ImgReRnd.ImageUrl = "image/butReExamdis.jpg";
                        this.ImgReRnd.Enabled = false;
                        this.ImgLook.Enabled = false;
                        break;

                    case "B":
                        this.labGetFen.Text = reader["GetCountFen"].ToString();
                        this.ImgLook.ImageUrl = "image/butLookMXDis.jpg";
                        this.ImgReRnd.ImageUrl = "image/butReExamdis.jpg";
                        this.ImgReRnd.Enabled = false;
                        this.ImgLook.Enabled = false;
                        this.ImgEnter.ImageUrl = "image/butAginExam.jpg";
                        break;

                    case "C":
                        this.labGetFen.Text = reader["GetCountFen"].ToString();
                        this.ImgLook.ImageUrl = "image/butLookMX.jpg";
                        this.ImgReRnd.ImageUrl = "image/butReExamdis.jpg";
                        this.ImgReRnd.Enabled = false;
                        this.ImgEnter.ImageUrl = "image/butEnterExamDis.jpg";
                        this.ImgEnter.Enabled = false;
                        break;

                    case "D":
                        this.labGetFen.Text = reader["GetCountFen"].ToString();
                        this.ImgLook.ImageUrl = "image/butLookMX.jpg";
                        this.ImgReRnd.ImageUrl = "image/butReExamdis.jpg";
                        this.ImgReRnd.Enabled = false;
                        this.ImgEnter.Enabled = false;
                        this.ImgEnter.ImageUrl = "image/butEnterExamDis.jpg";
                        break;

                    case "E":
                        this.labGetFen.Text = reader["GetCountFen"].ToString();
                        this.ImgLook.ImageUrl = "image/butLookMX.jpg";
                        this.ImgReRnd.ImageUrl = "image/butReExamdis.jpg";
                        this.ImgEnter.ImageUrl = "image/butEnterExamDis.jpg";
                        this.ImgReRnd.Enabled = false;
                        this.ImgEnter.Enabled = false;
                        break;

                    default:
                        this.labGetFen.Text = reader["GetCountFen"].ToString();
                        this.ImgLook.ImageUrl = "image/butLookMXDis.jpg";
                        this.ImgReRnd.ImageUrl = "image/butReExamdis.jpg";
                        this.ImgReRnd.Enabled = false;
                        this.ImgLook.Enabled = false;
                        break;
                }
                DateTime time2 = Convert.ToDateTime(reader["PaperStartTime"].ToString());
                DateTime time = Convert.ToDateTime(reader["PaperEndTime"].ToString());
                if (DateTime.Now < time2)
                {
                    this.ImgEnter.ImageUrl = "image/butEnterExamDis.jpg";
                    this.ImgEnter.Enabled = false;
                    base.Response.Write("<script>alert('考试起始时间未到,无法参加考试！')</script>");
                }
                if (DateTime.Now > time)
                {
                    this.ImgEnter.ImageUrl = "image/butEnterExamDis.jpg";
                    this.ImgEnter.Enabled = false;
                    base.Response.Write("<script>alert('考试结止时间已过,无法参加考试！')</script>");
                }
                string userIP = Convert.ToString(base.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]);
                string startIP = reader["StartIP"].ToString();
                string endIP = reader["EndIP"].ToString();
                if (!(!(userIP == "") ? (userIP != null) : false))
                {
                    userIP = Convert.ToString(base.Request.ServerVariables["REMOTE_ADDR"]);
                }
                if (!this.publicFun_0.CheckIP(userIP, startIP, endIP))
                {
                    this.ImgEnter.ImageUrl = "image/butEnterExamDis.jpg";
                    this.ImgEnter.Enabled = false;
                    base.Response.Write("<script>alert('入考场IP地址限制！')</script>");
                }
                if (reader["StudyPlanID"].ToString() != "0")
                {
                    string values = this.publicFun_0.GetValues("select c.CountTime/(a.StudyLongTime*60) as CountStudy from StudyPlanInfo a,StudyUser c  where c.UserCode='" + this.httpCookie_0.Value + "' and c.PlanID=a.ID and a.ID=" + reader["StudyPlanID"].ToString(), "CountStudy");
                    if (values.Trim() == "")
                    {
                        values = "0";
                    }
                    if (Convert.ToDouble(values) < 1.0)
                    {
                        this.ImgEnter.ImageUrl = "image/butEnterExamDis.jpg";
                        this.ImgEnter.Enabled = false;
                        base.Response.Write("<script>alert('学习任务未完成,无法参加考试！')</script>");
                    }
                }
                if (!(this.string_0 == "Y"))
                {
                    this.ImgReRnd.ImageUrl = "image/butReExamDis.jpg";
                    this.ImgReRnd.Enabled = false;
                }
                else
                {
                    if (reader["JoinExamNum"].ToString() != "0")
                    {
                        if (Convert.ToInt32(reader["ExamNum"].ToString()) >= Convert.ToInt32(reader["JoinExamNum"].ToString()))
                        {
                            this.ImgEnter.ImageUrl = "image/butEnterExamDis.jpg";
                            this.ImgEnter.Enabled = false;
                            this.ImgReRnd.ImageUrl = "image/butReExam.jpg";
                            this.ImgReRnd.Enabled = true;
                        }
                        int num2 = Convert.ToInt16(reader["JoinExamNum"].ToString());
                        int num3 = Convert.ToInt16(reader["ExamNum"].ToString());
                        if (num3 >= num2)
                        {
                            this.ImgReRnd.ImageUrl = "image/butReExamDis.jpg";
                            this.ImgReRnd.Enabled = false;
                        }
                        else
                        {
                            this.ImgReRnd.ImageUrl = "image/butReExam.jpg";
                            this.ImgReRnd.Enabled = true;
                            this.ImgReRnd.Attributes.Add("onclick", "javascript:{if(confirm('重考次数为【" + num3.ToString() + "／" + num2.ToString() + "】重考后之前成绩清零，确定要重考吗？')==false) return false;}");
                        }
                    }
                    if (reader["Flag"].ToString() == "A")
                    {
                        this.ImgReRnd.ImageUrl = "image/butReExamDis.jpg";
                        this.ImgReRnd.Enabled = false;
                    }
                }
                if (reader["Flag"].ToString() != "A")
                {
                    double num = Convert.ToDouble(reader["GetCountFen"].ToString());
                    if (this.ViewState["IsGradeLook"].ToString() == "N")
                    {
                        this.ImgLook.Enabled = false;
                        this.ImgLook.ImageUrl = "image/butLookMXDis.jpg";
                        this.labGetFen.Text = "";
                    }
                    if ((this.string_1 == "") || (this.string_1 == "Y"))
                    {
                        string str4 = this.publicFun_0.GetValues(string.Concat(new object[] { "select ReuleName from GradeReule where PaperID=", this.int_0, " and MinValue<=", num, " and ", num, "<=MaxValue" }), "ReuleName");
                        if (str4.Trim() == "")
                        {
                            str4 = this.publicFun_0.GetValues(string.Concat(new object[] { "select ReuleName from GradeReule where PaperID=0 and MinValue<=", num, " and ", num, "<=MaxValue" }), "ReuleName");
                            if (str4.Trim() == "")
                            {
                                str4 = "未定义";
                            }
                        }
                        this.labGetFen.Text = this.labGetFen.Text + "<font color=red>(" + str4 + ")</font>";
                    }
                    if (this.ViewState["IsGradeSort"].ToString() != "N")
                    {
                        this.labGetFen.Text = this.labGetFen.Text + "&nbsp;&nbsp;&nbsp;&nbsp;排名：" + this.method_1(this.int_0.ToString());
                    }
                }
                if (this.ViewState["UserPower"].ToString() == "Y")
                {
                    if ((this.publicFun_0.GetValues("select ParmValue from SysParmInfo where ParmMemo='LookPaperFlag'", "ParmValue").Trim().Trim() == "N") ? !(reader["Flag"].ToString() == "E") : true)
                    {
                        this.ImgLook.Enabled = false;
                        this.ImgLook.ImageUrl = "image/butLookMXDis.jpg";
                    }
                    else
                    {
                        this.ImgLook.ImageUrl = "image/butLookMX.jpg";
                    }
                }
                else
                {
                    this.ImgLook.Enabled = false;
                    this.ImgLook.ImageUrl = "image/butLookMXDis.jpg";
                }
            }
            reader.Close();
            command.Dispose();
            connection.Close();
            connection.Dispose();
        }

        private string method_1(string string_2)
        {
            string str = "0";
            int num = 0;
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            connection.Open();
            SqlCommand command = new SqlCommand("select * from ExamUser where PaperID=" + string_2 + " and  (Flag<>'A' and Flag<>'B') order by GetCountFen desc", connection);
            SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
            while (reader.Read())
            {
                num++;
                if (reader["UserCode"].ToString().Trim() == this.httpCookie_0.Value)
                {
                    str = num.ToString();
                }
            }
            reader.Close();
            command.Dispose();
            connection.Close();
            connection.Dispose();
            return str;
        }

        private void method_2(string string_2, string string_3, string string_4, string string_5, string string_6, string string_7)
        {
            string str = "#";
            string str2 = "#";
            string str3 = "#";
            string str4 = "#";
            string str5 = "#";
            string str6 = "#";
            string str7 = "#";
            string str8 = "#";
            string str9 = "#";
            Random random = new Random();
            bool flag = true;
            string[] strArray = string_3.Split(new char[] { '#' });
            string str10 = string_6;
            string strSql = "select ID from RubricInfo where IsDel='N' and Flag='" + str10 + "' and ISCheck='N' and (" + string_4 + ")";
            SqlConnection selectConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            DataSet dataSet = new DataSet();
            if (Convert.ToInt32(strArray[0]) > 0)
            {
                int num25 = Convert.ToInt32(strArray[0]);
                SqlDataAdapter adapter9 = new SqlDataAdapter(strSql + " and RubricType='A'", selectConnection);
                adapter9.Fill(dataSet, "AExamData");
                int count = dataSet.Tables["AExamData"].Rows.Count;
                while (flag)
                {
                    if (num25 == 0)
                    {
                        break;
                    }
                    int num27 = random.Next(count);
                    string str30 = dataSet.Tables["AExamData"].Rows[num27]["ID"].ToString() + "#";
                    if (str.IndexOf("#" + str30, 0) == -1)
                    {
                        str = str + str30;
                        num25--;
                    }
                }
                dataSet.Tables.Clear();
                adapter9.Dispose();
            }
            if (Convert.ToInt32(strArray[1]) > 0)
            {
                int num22 = Convert.ToInt32(strArray[1]);
                SqlDataAdapter adapter8 = new SqlDataAdapter(strSql + " and RubricType='B'", selectConnection);
                adapter8.Fill(dataSet, "BExamData");
                int maxValue = dataSet.Tables["BExamData"].Rows.Count;
                while (flag)
                {
                    if (num22 == 0)
                    {
                        break;
                    }
                    int num24 = random.Next(maxValue);
                    string str28 = dataSet.Tables["BExamData"].Rows[num24]["ID"].ToString() + "#";
                    if (str2.IndexOf("#" + str28, 0) == -1)
                    {
                        str2 = str2 + str28;
                        num22--;
                    }
                }
                dataSet.Tables.Clear();
                adapter8.Dispose();
            }
            if (Convert.ToInt32(strArray[2]) > 0)
            {
                int num19 = Convert.ToInt32(strArray[2]);
                SqlDataAdapter adapter7 = new SqlDataAdapter(strSql + " and RubricType='C'", selectConnection);
                adapter7.Fill(dataSet, "CExamData");
                int num20 = dataSet.Tables["CExamData"].Rows.Count;
                while (flag)
                {
                    if (num19 == 0)
                    {
                        break;
                    }
                    int num21 = random.Next(num20);
                    string str26 = dataSet.Tables["CExamData"].Rows[num21]["ID"].ToString() + "#";
                    if (str3.IndexOf("#" + str26, 0) == -1)
                    {
                        str3 = str3 + str26;
                        num19--;
                    }
                }
                dataSet.Tables.Clear();
                adapter7.Dispose();
            }
            if (Convert.ToInt32(strArray[3]) > 0)
            {
                int num16 = Convert.ToInt32(strArray[3]);
                SqlDataAdapter adapter6 = new SqlDataAdapter(strSql + " and RubricType='D'", selectConnection);
                adapter6.Fill(dataSet, "DExamData");
                int num17 = dataSet.Tables["DExamData"].Rows.Count;
                while (flag)
                {
                    if (num16 == 0)
                    {
                        break;
                    }
                    int num18 = random.Next(num17);
                    string str24 = dataSet.Tables["DExamData"].Rows[num18]["ID"].ToString() + "#";
                    if (str4.IndexOf("#" + str24, 0) == -1)
                    {
                        str4 = str4 + str24;
                        num16--;
                    }
                }
                dataSet.Tables.Clear();
                adapter6.Dispose();
            }
            if (Convert.ToInt32(strArray[4]) > 0)
            {
                int num13 = Convert.ToInt32(strArray[4]);
                SqlDataAdapter adapter5 = new SqlDataAdapter(strSql + " and RubricType='E'", selectConnection);
                adapter5.Fill(dataSet, "EExamData");
                int num14 = dataSet.Tables["EExamData"].Rows.Count;
                while (flag)
                {
                    if (num13 == 0)
                    {
                        break;
                    }
                    int num15 = random.Next(num14);
                    string str22 = dataSet.Tables["EExamData"].Rows[num15]["ID"].ToString() + "#";
                    if (str5.IndexOf("#" + str22, 0) == -1)
                    {
                        str5 = str5 + str22;
                        num13--;
                    }
                }
                dataSet.Tables.Clear();
                adapter5.Dispose();
            }
            if (Convert.ToInt32(strArray[5]) > 0)
            {
                int num10 = Convert.ToInt32(strArray[5]);
                SqlDataAdapter adapter4 = new SqlDataAdapter(strSql + " and RubricType='F'", selectConnection);
                adapter4.Fill(dataSet, "FExamData");
                int num11 = dataSet.Tables["FExamData"].Rows.Count;
                while (flag)
                {
                    if (num10 == 0)
                    {
                        break;
                    }
                    int num12 = random.Next(num11);
                    string str20 = dataSet.Tables["FExamData"].Rows[num12]["ID"].ToString() + "#";
                    if (str6.IndexOf("#" + str20, 0) == -1)
                    {
                        str6 = str6 + str20;
                        num10--;
                    }
                }
                dataSet.Tables.Clear();
                adapter4.Dispose();
            }
            if (Convert.ToInt32(strArray[6]) > 0)
            {
                int num7 = Convert.ToInt32(strArray[6]);
                SqlDataAdapter adapter3 = new SqlDataAdapter(strSql + " and RubricType='G'", selectConnection);
                adapter3.Fill(dataSet, "GExamData");
                int num8 = dataSet.Tables["GExamData"].Rows.Count;
                while (flag)
                {
                    if (num7 == 0)
                    {
                        break;
                    }
                    int num9 = random.Next(num8);
                    string str18 = dataSet.Tables["GExamData"].Rows[num9]["ID"].ToString() + "#";
                    if (str7.IndexOf("#" + str18, 0) == -1)
                    {
                        str7 = str7 + str18;
                        num7--;
                    }
                }
                dataSet.Tables.Clear();
                adapter3.Dispose();
            }
            if (Convert.ToInt32(strArray[7]) > 0)
            {
                int num4 = Convert.ToInt32(strArray[7]);
                SqlDataAdapter adapter2 = new SqlDataAdapter(strSql + " and RubricType='H'", selectConnection);
                adapter2.Fill(dataSet, "HExamData");
                int num5 = dataSet.Tables["HExamData"].Rows.Count;
                while (flag)
                {
                    if (num4 == 0)
                    {
                        break;
                    }
                    int num6 = random.Next(num5);
                    string str16 = dataSet.Tables["HExamData"].Rows[num6]["ID"].ToString() + "#";
                    if (str8.IndexOf("#" + str16, 0) == -1)
                    {
                        str8 = str8 + str16;
                        num4--;
                    }
                }
                dataSet.Tables.Clear();
                adapter2.Dispose();
            }
            if (Convert.ToInt32(strArray[8]) > 0)
            {
                int num = Convert.ToInt32(strArray[8]);
                SqlDataAdapter adapter = new SqlDataAdapter(strSql + " and RubricType='I'", selectConnection);
                adapter.Fill(dataSet, "IExamData");
                int num2 = dataSet.Tables["IExamData"].Rows.Count;
                while (flag)
                {
                    if (num == 0)
                    {
                        break;
                    }
                    int num3 = random.Next(num2);
                    string str14 = dataSet.Tables["IExamData"].Rows[num3]["ID"].ToString() + "#";
                    if (str9.IndexOf("#" + str14, 0) == -1)
                    {
                        str9 = str9 + str14;
                        num--;
                    }
                }
                dataSet.Tables.Clear();
                adapter.Dispose();
            }
            dataSet.Clear();
            dataSet.Dispose();
            selectConnection.Close();
            selectConnection.Dispose();
            string values = this.publicFun_0.GetValues("select top 1 RubricJ from PaperData where PaperID=" + string_2, "RubricJ");
            if (values != "")
            {
                values = values.Trim().Replace("_", "#");
            }
            else
            {
                values = "";
            }
            if (str.Length > 1)
            {
                str = str.Substring(1);
            }
            else
            {
                str = "";
            }
            if (str2.Length <= 1)
            {
                str2 = "";
            }
            else
            {
                str2 = str2.Substring(1);
            }
            if (str3.Length > 1)
            {
                str3 = str3.Substring(1);
            }
            else
            {
                str3 = "";
            }
            if (str4.Length > 1)
            {
                str4 = str4.Substring(1);
            }
            else
            {
                str4 = "";
            }
            if (str5.Length > 1)
            {
                str5 = str5.Substring(1);
            }
            else
            {
                str5 = "";
            }
            if (str6.Length <= 1)
            {
                str6 = "";
            }
            else
            {
                str6 = str6.Substring(1);
            }
            if (str7.Length > 1)
            {
                str7 = str7.Substring(1);
            }
            else
            {
                str7 = "";
            }
            if (str8.Length <= 1)
            {
                str8 = "";
            }
            else
            {
                str8 = str8.Substring(1);
            }
            if (str9.Length > 1)
            {
                str9 = str9.Substring(1);
            }
            else
            {
                str9 = "";
            }
            strSql = "update ExamUser set LastTime='" + string_7 + "',Flag='A',IsSave=0,StartTime='',EndTime='',GetOldCountFen=0,GetCountFen=0,LoginIP='' where UserCode='" + this.httpCookie_0.Value + "' and PaperID=" + string_2;
            strSql = strSql + ";update PaperData set RubricS='" + str + "',RubricD='" + str2 + "',RubricB='" + str3 + "',RubricF='" + str4 + "',RubricA='" + str5 + "',RubricC='" + str6 + "',RubricT='" + str7 + "',RubricAN='" + str8 + "',RubricO='" + str9 + "',RubricJ='" + values + "' where PaperID='" + string_2 + "' and UserCode='" + this.httpCookie_0.Value + "'";
            strSql = strSql + ";delete from CheckPaper where  UserCode='" + this.httpCookie_0.Value + "' and PaperID=" + string_2;
            this.publicFun_0.ExecuteSql(strSql);
        }

        private void method_3(string string_2, string string_3, string string_4, string string_5)
        {
            SqlDataReader reader;
            SqlCommand command;
            SqlConnection connection2;
            string str14;
            int count;
            int num3;
            string str = "#";
            string str2 = "#";
            string str3 = "#";
            string str4 = "#";
            string str5 = "#";
            string str6 = "#";
            string str7 = "#";
            string str8 = "#";
            string str9 = "#";
            Random random = new Random();
            bool flag = true;
            string str10 = "";
            int num = 0;
            string[] strArray = string_4.Split(new char[] { '#' });
            string strSql = "";
            string connectionString = ConfigurationManager.ConnectionStrings["Conn"].ConnectionString;
            SqlConnection selectConnection = new SqlConnection(connectionString);
            DataSet dataSet = new DataSet();
            if (Convert.ToInt32(strArray[0]) > 0)
            {
                connection2 = new SqlConnection(connectionString);
                connection2.Open();
                command = new SqlCommand("select RuleValue,GetNum from PaperRule where PaperID=" + string_2 + " and RubricType='A'", connection2);
                reader = command.ExecuteReader(CommandBehavior.CloseConnection);
                SqlDataAdapter adapter9 = null;
                while (reader.Read())
                {
                    str10 = reader["RuleValue"].ToString().Trim().Replace('‘', '\'').Replace("’", "'");
                    num = Convert.ToInt32(reader["GetNum"].ToString().Trim());
                    adapter9 = new SqlDataAdapter(string_3 + "  and (" + str10 + ")", selectConnection);
                    adapter9.Fill(dataSet, "AExamData");
                    count = dataSet.Tables["AExamData"].Rows.Count;
                    while (flag)
                    {
                        if (num == 0)
                        {
                            break;
                        }
                        num3 = random.Next(count);
                        str14 = dataSet.Tables["AExamData"].Rows[num3]["ID"].ToString() + "#";
                        if (str.IndexOf("#" + str14, 0) == -1)
                        {
                            str = str + str14;
                            num--;
                        }
                    }
                    adapter9.Dispose();
                    dataSet.Tables.Clear();
                }
                reader.Close();
                command.Dispose();
                connection2.Close();
                connection2.Dispose();
            }
            if (Convert.ToInt32(strArray[1]) > 0)
            {
                connection2 = new SqlConnection(connectionString);
                connection2.Open();
                command = new SqlCommand("select RuleValue,GetNum from PaperRule where PaperID=" + string_2 + " and RubricType='B'", connection2);
                reader = command.ExecuteReader(CommandBehavior.CloseConnection);
                SqlDataAdapter adapter8 = null;
                while (reader.Read())
                {
                    str10 = reader["RuleValue"].ToString().Trim().Replace('‘', '\'').Replace("’", "'");
                    num = Convert.ToInt32(reader["GetNum"].ToString().Trim());
                    adapter8 = new SqlDataAdapter(string_3 + " and (" + str10 + ")", selectConnection);
                    adapter8.Fill(dataSet, "BExamData");
                    count = dataSet.Tables["BExamData"].Rows.Count;
                    while (flag)
                    {
                        if (num == 0)
                        {
                            break;
                        }
                        num3 = random.Next(count);
                        str14 = dataSet.Tables["BExamData"].Rows[num3]["ID"].ToString() + "#";
                        if (str2.IndexOf("#" + str14, 0) == -1)
                        {
                            str2 = str2 + str14;
                            num--;
                        }
                    }
                    adapter8.Dispose();
                    dataSet.Tables.Clear();
                }
                reader.Close();
                command.Dispose();
                connection2.Close();
                connection2.Dispose();
            }
            if (Convert.ToInt32(strArray[2]) > 0)
            {
                connection2 = new SqlConnection(connectionString);
                connection2.Open();
                command = new SqlCommand("select RuleValue,GetNum from PaperRule where PaperID=" + string_2 + " and RubricType='C'", connection2);
                reader = command.ExecuteReader(CommandBehavior.CloseConnection);
                SqlDataAdapter adapter7 = null;
                while (reader.Read())
                {
                    str10 = reader["RuleValue"].ToString().Trim().Replace('‘', '\'').Replace("’", "'");
                    num = Convert.ToInt32(reader["GetNum"].ToString().Trim());
                    adapter7 = new SqlDataAdapter(string_3 + " and (" + str10 + ")", selectConnection);
                    adapter7.Fill(dataSet, "CExamData");
                    count = dataSet.Tables["CExamData"].Rows.Count;
                    while (flag)
                    {
                        if (num == 0)
                        {
                            break;
                        }
                        num3 = random.Next(count);
                        str14 = dataSet.Tables["CExamData"].Rows[num3]["ID"].ToString() + "#";
                        if (str3.IndexOf("#" + str14, 0) == -1)
                        {
                            str3 = str3 + str14;
                            num--;
                        }
                    }
                    adapter7.Dispose();
                    dataSet.Tables.Clear();
                }
                reader.Close();
                command.Dispose();
                connection2.Close();
                connection2.Dispose();
            }
            if (Convert.ToInt32(strArray[3]) > 0)
            {
                connection2 = new SqlConnection(connectionString);
                connection2.Open();
                command = new SqlCommand("select RuleValue,GetNum from PaperRule where PaperID=" + string_2 + " and RubricType='D'", connection2);
                reader = command.ExecuteReader(CommandBehavior.CloseConnection);
                SqlDataAdapter adapter6 = null;
                while (reader.Read())
                {
                    str10 = reader["RuleValue"].ToString().Trim().Replace('‘', '\'').Replace("’", "'");
                    num = Convert.ToInt32(reader["GetNum"].ToString().Trim());
                    adapter6 = new SqlDataAdapter(string_3 + " and (" + str10 + ")", selectConnection);
                    adapter6.Fill(dataSet, "DExamData");
                    count = dataSet.Tables["DExamData"].Rows.Count;
                    while (flag)
                    {
                        if (num == 0)
                        {
                            break;
                        }
                        num3 = random.Next(count);
                        str14 = dataSet.Tables["DExamData"].Rows[num3]["ID"].ToString() + "#";
                        if (str4.IndexOf("#" + str14, 0) == -1)
                        {
                            str4 = str4 + str14;
                            num--;
                        }
                    }
                    adapter6.Dispose();
                    dataSet.Tables.Clear();
                }
                reader.Close();
                command.Dispose();
                connection2.Close();
                connection2.Dispose();
            }
            if (Convert.ToInt32(strArray[4]) > 0)
            {
                connection2 = new SqlConnection(connectionString);
                connection2.Open();
                command = new SqlCommand("select RuleValue,GetNum from PaperRule where PaperID=" + string_2 + " and RubricType='E'", connection2);
                reader = command.ExecuteReader(CommandBehavior.CloseConnection);
                SqlDataAdapter adapter5 = null;
                while (reader.Read())
                {
                    str10 = reader["RuleValue"].ToString().Trim().Replace('‘', '\'').Replace("’", "'");
                    num = Convert.ToInt32(reader["GetNum"].ToString().Trim());
                    adapter5 = new SqlDataAdapter(string_3 + " and (" + str10 + ")", selectConnection);
                    adapter5.Fill(dataSet, "EExamData");
                    count = dataSet.Tables["EExamData"].Rows.Count;
                    while (flag)
                    {
                        if (num == 0)
                        {
                            break;
                        }
                        num3 = random.Next(count);
                        str14 = dataSet.Tables["EExamData"].Rows[num3]["ID"].ToString() + "#";
                        if (str5.IndexOf("#" + str14, 0) == -1)
                        {
                            str5 = str5 + str14;
                            num--;
                        }
                    }
                    adapter5.Dispose();
                    dataSet.Tables.Clear();
                }
                reader.Close();
                command.Dispose();
                connection2.Close();
                connection2.Dispose();
            }
            if (Convert.ToInt32(strArray[5]) > 0)
            {
                connection2 = new SqlConnection(connectionString);
                connection2.Open();
                command = new SqlCommand("select RuleValue,GetNum from PaperRule where PaperID=" + string_2 + " and RubricType='F'", connection2);
                reader = command.ExecuteReader(CommandBehavior.CloseConnection);
                SqlDataAdapter adapter4 = null;
                while (reader.Read())
                {
                    str10 = reader["RuleValue"].ToString().Trim().Replace('‘', '\'').Replace("’", "'");
                    num = Convert.ToInt32(reader["GetNum"].ToString().Trim());
                    adapter4 = new SqlDataAdapter(string_3 + " and (" + str10 + ")", selectConnection);
                    adapter4.Fill(dataSet, "FExamData");
                    count = dataSet.Tables["FExamData"].Rows.Count;
                    while (flag)
                    {
                        if (num == 0)
                        {
                            break;
                        }
                        num3 = random.Next(count);
                        str14 = dataSet.Tables["FExamData"].Rows[num3]["ID"].ToString() + "#";
                        if (str6.IndexOf("#" + str14, 0) == -1)
                        {
                            str6 = str6 + str14;
                            num--;
                        }
                    }
                    adapter4.Dispose();
                    dataSet.Tables.Clear();
                }
                reader.Close();
                command.Dispose();
                connection2.Close();
                connection2.Dispose();
            }
            if (Convert.ToInt32(strArray[6]) > 0)
            {
                connection2 = new SqlConnection(connectionString);
                connection2.Open();
                command = new SqlCommand("select RuleValue,GetNum from PaperRule where PaperID=" + string_2 + " and RubricType='G'", connection2);
                reader = command.ExecuteReader(CommandBehavior.CloseConnection);
                SqlDataAdapter adapter3 = null;
                while (reader.Read())
                {
                    str10 = reader["RuleValue"].ToString().Trim().Replace('‘', '\'').Replace("’", "'");
                    num = Convert.ToInt32(reader["GetNum"].ToString().Trim());
                    adapter3 = new SqlDataAdapter(string_3 + " and (" + str10 + ")", selectConnection);
                    adapter3.Fill(dataSet, "GExamData");
                    count = dataSet.Tables["GExamData"].Rows.Count;
                    while (flag)
                    {
                        if (num == 0)
                        {
                            break;
                        }
                        num3 = random.Next(count);
                        str14 = dataSet.Tables["GExamData"].Rows[num3]["ID"].ToString() + "#";
                        if (str7.IndexOf("#" + str14, 0) == -1)
                        {
                            str7 = str7 + str14;
                            num--;
                        }
                    }
                    adapter3.Dispose();
                    dataSet.Tables.Clear();
                }
                reader.Close();
                command.Dispose();
                connection2.Close();
                connection2.Dispose();
            }
            if (Convert.ToInt32(strArray[7]) > 0)
            {
                connection2 = new SqlConnection(connectionString);
                connection2.Open();
                command = new SqlCommand("select RuleValue,GetNum from PaperRule where PaperID=" + string_2 + " and RubricType='H'", connection2);
                reader = command.ExecuteReader(CommandBehavior.CloseConnection);
                SqlDataAdapter adapter2 = null;
                while (reader.Read())
                {
                    str10 = reader["RuleValue"].ToString().Trim().Replace('‘', '\'').Replace("’", "'");
                    num = Convert.ToInt32(reader["GetNum"].ToString().Trim());
                    adapter2 = new SqlDataAdapter(string_3 + " and (" + str10 + ")", selectConnection);
                    adapter2.Fill(dataSet, "HExamData");
                    count = dataSet.Tables["HExamData"].Rows.Count;
                    while (flag)
                    {
                        if (num == 0)
                        {
                            break;
                        }
                        num3 = random.Next(count);
                        str14 = dataSet.Tables["HExamData"].Rows[num3]["ID"].ToString() + "#";
                        if (str8.IndexOf("#" + str14, 0) == -1)
                        {
                            str8 = str8 + str14;
                            num--;
                        }
                    }
                    adapter2.Dispose();
                    dataSet.Tables.Clear();
                }
                reader.Close();
                command.Dispose();
                connection2.Close();
                connection2.Dispose();
            }
            if (Convert.ToInt32(strArray[8]) > 0)
            {
                connection2 = new SqlConnection(connectionString);
                connection2.Open();
                command = new SqlCommand("select RuleValue,GetNum from PaperRule where PaperID=" + string_2 + " and RubricType='I'", connection2);
                reader = command.ExecuteReader(CommandBehavior.CloseConnection);
                SqlDataAdapter adapter = null;
                while (reader.Read())
                {
                    str10 = reader["RuleValue"].ToString().Trim().Replace('‘', '\'').Replace("’", "'");
                    num = Convert.ToInt32(reader["GetNum"].ToString().Trim());
                    adapter = new SqlDataAdapter(string_3 + " and (" + str10 + ")", selectConnection);
                    adapter.Fill(dataSet, "IExamData");
                    count = dataSet.Tables["IExamData"].Rows.Count;
                    while (flag)
                    {
                        if (num == 0)
                        {
                            break;
                        }
                        num3 = random.Next(count);
                        str14 = dataSet.Tables["IExamData"].Rows[num3]["ID"].ToString() + "#";
                        if (str9.IndexOf("#" + str14, 0) == -1)
                        {
                            str9 = str9 + str14;
                            num--;
                        }
                    }
                    adapter.Dispose();
                    dataSet.Tables.Clear();
                }
                reader.Close();
                command.Dispose();
                connection2.Close();
                connection2.Dispose();
            }
            dataSet.Clear();
            dataSet.Dispose();
            selectConnection.Close();
            selectConnection.Dispose();
            string values = this.publicFun_0.GetValues("select top 1 RubricJ from PaperData where PaperID=" + string_2, "RubricJ");
            if (values != "")
            {
                values = values.Trim().Replace("_", "#");
            }
            else
            {
                values = "";
            }
            if (str.Length <= 1)
            {
                str = "";
            }
            else
            {
                str = str.Substring(1);
            }
            if (str2.Length <= 1)
            {
                str2 = "";
            }
            else
            {
                str2 = str2.Substring(1);
            }
            if (str3.Length > 1)
            {
                str3 = str3.Substring(1);
            }
            else
            {
                str3 = "";
            }
            if (str4.Length <= 1)
            {
                str4 = "";
            }
            else
            {
                str4 = str4.Substring(1);
            }
            if (str5.Length <= 1)
            {
                str5 = "";
            }
            else
            {
                str5 = str5.Substring(1);
            }
            if (str6.Length <= 1)
            {
                str6 = "";
            }
            else
            {
                str6 = str6.Substring(1);
            }
            if (str7.Length <= 1)
            {
                str7 = "";
            }
            else
            {
                str7 = str7.Substring(1);
            }
            if (str8.Length <= 1)
            {
                str8 = "";
            }
            else
            {
                str8 = str8.Substring(1);
            }
            if (str9.Length <= 1)
            {
                str9 = "";
            }
            else
            {
                str9 = str9.Substring(1);
            }
            strSql = "update ExamUser set LastTime='" + string_5 + "',Flag='A',IsSave=0,StartTime='',EndTime='',GetOldCountFen=0,GetCountFen=0,LoginIP='' where UserCode='" + this.httpCookie_0.Value + "' and PaperID=" + string_2;
            strSql = strSql + ";update PaperData set RubricS='" + str + "',RubricD='" + str2 + "',RubricB='" + str3 + "',RubricF='" + str4 + "',RubricA='" + str5 + "',RubricC='" + str6 + "',RubricT='" + str7 + "',RubricAN='" + str8 + "',RubricO='" + str9 + "',RubricJ='" + values + "' where PaperID='" + string_2 + "' and UserCode='" + this.httpCookie_0.Value + "'";
            strSql = strSql + ";delete from CheckPaper where  UserCode='" + this.httpCookie_0.Value + "' and PaperID=" + string_2;
            this.publicFun_0.ExecuteSql(strSql);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            this.httpCookie_0 = new HttpCookie("ExamUserCode");
            this.httpCookie_0 = base.Request.Cookies["ExamUserCode"];
            this.httpCookie_1 = new HttpCookie("ExamUserName");
            this.httpCookie_1 = base.Request.Cookies["ExamUserName"];
            this.httpCookie_2 = new HttpCookie("ExamUserLevel");
            this.httpCookie_2 = base.Request.Cookies["ExamUserLevel"];
            this.httpCookie_3 = new HttpCookie("ExamDeptID");
            this.httpCookie_3 = base.Request.Cookies["ExamDeptID"];
            if ((this.httpCookie_0 != null) ? !(this.httpCookie_0.Value == "") : false)
            {
                base.Response.Cache.SetCacheability(HttpCacheability.NoCache);
                base.Response.Cache.SetNoStore();
                this.httpCookie_0.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_0.Value));
                this.httpCookie_1.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_1.Value));
                this.httpCookie_2.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_2.Value));
                this.httpCookie_3.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_3.Value));
                this.int_0 = Convert.ToInt32(base.Request["ID"]);
                if (!base.IsPostBack)
                {
                    this.string_0 = this.publicFun_0.GetValues("select ParmValue from SysParmInfo where ParmMemo='IsSetReExam'", "ParmValue").Trim();
                    this.string_1 = this.publicFun_0.GetValues("select ParmValue from SysParmInfo where ParmMemo='IsGradeStand'", "ParmValue").Trim();
                    this.ViewState["UserPower"] = this.publicFun_0.GetValues("select LookPaper from UserPower where UserCode='" + this.httpCookie_0.Value + "'", "LookPaper");
                    this.ViewState["IsGradeSort"] = this.publicFun_0.GetValues("select ParmValue from SysParmInfo where ParmMemo='IsGradeSort'", "ParmValue").Trim();
                    this.ViewState["IsGradeLook"] = this.publicFun_0.GetValues("select ParmValue from SysParmInfo where ParmMemo='IsGradeLook'", "ParmValue").Trim();
                    this.Page.Title = ConfigurationManager.ConnectionStrings["ProTitle"].ConnectionString;
                    this.method_0();
                    if (this.labExamName.Text.Trim() == "")
                    {
                        this.ImgEnter.Enabled = false;
                        this.ImgLook.Enabled = false;
                        this.ImgReRnd.Enabled = false;
                        this.ImgEnter.ImageUrl = "image/butEnterExamDis.jpg";
                        this.ImgLook.ImageUrl = "image/butLookMXDis.jpg";
                        this.ImgReRnd.ImageUrl = "image/butReExamdis.jpg";
                    }
                    if (this.ImgEnter.ImageUrl == "image/butEnterExam.jpg")
                    {
                        this.ImgEnter.Attributes.Add("onclick", "javascript:{if(confirm('确定要进入正规考场吗？')==false) return false;}");
                        this.ImgEnter.Enabled = true;
                    }
                    else if (!(this.ImgEnter.ImageUrl == "image/butAginExam.jpg"))
                    {
                        this.ImgEnter.Enabled = false;
                    }
                    else
                    {
                        this.ImgEnter.Attributes.Add("onclick", "javascript:{if(confirm('确定要补交试卷吗？')==false) return false;}");
                        this.ImgEnter.Enabled = true;
                    }
                    if (!(this.ImgLook.ImageUrl == "image/butLookMXDis.jpg"))
                    {
                        this.ImgLook.Enabled = true;
                    }
                    else
                    {
                        this.ImgLook.Enabled = false;
                    }
                }
            }
            else
            {
                base.Response.Write("<script language=javascript>window.location.href='FrmLogin.aspx';</script>");
            }
        }

        protected void SysEnterPaper()
        {
            string str = this.int_0.ToString();
            string text = this.labExamName.Text;
            string str3 = DateTime.Now.Hour.ToString() + ":" + DateTime.Now.Minute.ToString() + ":" + DateTime.Now.Second.ToString();
            string str4 = "E";
            double num2 = 0.0;
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            connection.Open();
            SqlCommand command = new SqlCommand("select RubricSFen,RubricDFen,RubricBFen,RubricFFen,RubricAFen,RubricCFen,RubricTFen,RubricANFen,RubricOFen,RubricJFen from CheckPaper where UserCode='" + this.httpCookie_0.Value + "' and PaperID='" + str + "'", connection);
            SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
            if (reader.Read())
            {
                int num4;
                if (((((reader["RubricAFen"].ToString().Trim() != "") || (reader["RubricCFen"].ToString().Trim() != "")) || ((reader["RubricTFen"].ToString().Trim() != "") || (reader["RubricANFen"].ToString().Trim() != ""))) || ((reader["RubricOFen"].ToString().Trim() != "") || (reader["RubricJFen"].ToString().Trim() != ""))) || (reader["RubricFFen"].ToString().Trim() != ""))
                {
                    str4 = "D";
                }
                else
                {
                    str4 = "E";
                }
                if (reader["RubricSFen"].ToString().Trim() != "")
                {
                    string[] strArray11 = reader["RubricSFen"].ToString().Trim().Split(new char[] { '|' });
                    for (num4 = 0; num4 < strArray11.Length; num4++)
                    {
                        if (strArray11[num4].Trim() != "")
                        {
                            num2 += Convert.ToDouble(strArray11[num4].Trim());
                        }
                    }
                }
                if (reader["RubricDFen"].ToString().Trim() != "")
                {
                    string[] strArray10 = reader["RubricDFen"].ToString().Trim().Split(new char[] { '|' });
                    for (num4 = 0; num4 < strArray10.Length; num4++)
                    {
                        if (strArray10[num4].Trim() != "")
                        {
                            num2 += Convert.ToDouble(strArray10[num4].Trim());
                        }
                    }
                }
                if (reader["RubricBFen"].ToString().Trim() != "")
                {
                    string[] strArray9 = reader["RubricBFen"].ToString().Trim().Split(new char[] { '|' });
                    for (num4 = 0; num4 < strArray9.Length; num4++)
                    {
                        if (strArray9[num4].Trim() != "")
                        {
                            num2 += Convert.ToDouble(strArray9[num4].Trim());
                        }
                    }
                }
                if (reader["RubricFFen"].ToString().Trim() != "")
                {
                    string[] strArray8 = reader["RubricFFen"].ToString().Trim().Split(new char[] { '|' });
                    for (num4 = 0; num4 < strArray8.Length; num4++)
                    {
                        if (strArray8[num4].Trim() != "")
                        {
                            num2 += Convert.ToDouble(strArray8[num4].Trim());
                        }
                    }
                }
                if (reader["RubricAFen"].ToString().Trim() != "")
                {
                    string[] strArray7 = reader["RubricAFen"].ToString().Trim().Split(new char[] { '|' });
                    for (num4 = 0; num4 < strArray7.Length; num4++)
                    {
                        if (strArray7[num4].Trim() != "")
                        {
                            num2 += Convert.ToDouble(strArray7[num4].Trim());
                        }
                    }
                }
                if (reader["RubricCFen"].ToString().Trim() != "")
                {
                    string[] strArray6 = reader["RubricCFen"].ToString().Trim().Split(new char[] { '|' });
                    for (num4 = 0; num4 < strArray6.Length; num4++)
                    {
                        if (strArray6[num4].Trim() != "")
                        {
                            num2 += Convert.ToDouble(strArray6[num4].Trim());
                        }
                    }
                }
                if (reader["RubricANFen"].ToString().Trim() != "")
                {
                    string[] strArray5 = reader["RubricANFen"].ToString().Trim().Split(new char[] { '|' });
                    for (num4 = 0; num4 < strArray5.Length; num4++)
                    {
                        if (strArray5[num4].Trim() != "")
                        {
                            num2 += Convert.ToDouble(strArray5[num4].Trim());
                        }
                    }
                }
                if (reader["RubricTFen"].ToString().Trim() != "")
                {
                    string[] strArray4 = reader["RubricTFen"].ToString().Trim().Split(new char[] { '|' });
                    for (num4 = 0; num4 < strArray4.Length; num4++)
                    {
                        if (strArray4[num4].Trim() != "")
                        {
                            num2 += Convert.ToDouble(strArray4[num4].Trim());
                        }
                    }
                }
                if (reader["RubricOFen"].ToString().Trim() != "")
                {
                    string[] strArray3 = reader["RubricOFen"].ToString().Trim().Split(new char[] { '|' });
                    for (num4 = 0; num4 < strArray3.Length; num4++)
                    {
                        if (strArray3[num4].Trim() != "")
                        {
                            num2 += Convert.ToDouble(strArray3[num4].Trim());
                        }
                    }
                }
                if (reader["RubricJFen"].ToString().Trim() != "")
                {
                    string[] strArray2 = reader["RubricJFen"].ToString().Trim().Split(new char[] { '|' });
                    for (num4 = 0; num4 < strArray2.Length; num4++)
                    {
                        if (strArray2[num4].Trim() != "")
                        {
                            num2 += Convert.ToDouble(strArray2[num4].Trim());
                        }
                    }
                }
                this.publicFun_0.ExecuteSql(string.Concat(new object[] { 
                    "update ExamUser set GetOldCountFen=", num2, ",GetCountFen=", num2, ",Flag='", str4, "',EndTime='", str3, "',LastDate='", DateTime.Now.ToShortDateString(), "' where UserCode='", this.httpCookie_0.Value, "' and PaperID='", str, "';insert into SysLogInfo(LogDisp,EditUser,EditUserCode) values('考生自己强行交卷[", text, 
                    "]！','", this.httpCookie_1.Value, "','", this.httpCookie_0.Value, "')"
                 }));
            }
            else
            {
                this.publicFun_0.ExecuteSql("update ExamUser set GetOldCountFen=0,GetCountFen=0,Flag='E',EndTime='" + str3 + "',LastDate='" + DateTime.Now.ToShortDateString() + "' where UserCode='" + this.httpCookie_0.Value + "' and PaperID='" + str + "';insert into SysLogInfo(LogDisp,EditUser,EditUserCode) values('考生自己强行交卷[" + text + "]！','" + this.httpCookie_1.Value + "','" + this.httpCookie_0.Value + "')");
            }
            reader.Close();
            command.Dispose();
            connection.Close();
            connection.Dispose();
            double num3 = 0.0;
            string values = this.publicFun_0.GetValues(string.Concat(new object[] { "select StudyFen from GradeReule where PaperID=", str, " and (", num2, ">=MinValue  and ", num2, "<=MaxValue)" }), "StudyFen");
            if (values.Trim() == "")
            {
                values = "0";
            }
            num3 = Convert.ToDouble(values);
            this.publicFun_0.ExecuteSql(string.Concat(new object[] { "delete  UserStudyFen where UserCode='", this.httpCookie_0.Value, "' and ExamOrStudy='E' and Formtable='PaperInfo' and FormID=", str, ";insert into UserStudyFen(UserCode,ExamStudyName,StudyFen,Formtable,FormID,ExamOrStudy) values('", this.httpCookie_0.Value, "','", text, "','", num3, "','PaperInfo','", str, "','E')" }));
            this.method_0();
            base.Response.Write("<script>alert('强行交卷操作成功！');</script>");
        }
    }
}

